﻿#include"contact.h"
void menu()
{
	printf("**********************************\n");
	printf("*****  1.add       2.dele   ******\n");
	printf("*****  3.select    4.modify ******\n");
	printf("*****  5.show      6.sort   ******\n");
	printf("*****  0.exit               ******\n");
	printf("**********************************\n");
}
int main()
{
	int input = 0;
	struct contact con;
	initcontact(&con);
	do
	{
		menu();
		printf("请选择你要进行的操作>:");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			addcontact(&con);
			break;
		case 2:
			delecontact(&con);
			break;
		case 3:
			selectcontact(&con);
			break;
		case 4:
			modifycontact(&con);
			break;
		case 5:
			showcontact(&con);
			break;
		case 6:
			sortcontact(&con);
			break;
		case 0:
			savedata(&con);
			freerealloc(&con);
			printf("退出成功！\n");
			break;
		default:
			printf("输入错误！\n");
			break;
		}
	} while (input);

	return 0;
}